#include<iostream>
using namespace std;

int main(){
    long long n,m,gcd,lcm;
    while(cin >> n >> m){
        long long a=n,b=m,temp=1;
        while(temp){
            temp = a%b;
            a = b;
            b = temp;
        }
        gcd = a;
        lcm = m*n/gcd;
        cout << gcd+lcm << endl;
    }
    return 0;
}
